<!DOCTYPE html>
<html lang="en">
<head>
  <meta charset="UTF-8">
  <meta http-equiv="X-UA-Compatible" content="IE=edge">
  <meta name="viewport" content="width=device-width, initial-scale=1.0">
  <title>Document</title>
</head>
<body>
  
</body>
<script>
  class Animal {
    eat(name) {
      console.log(name + "吃东西");
    }
    sayName(name) {
      console.log("Animal_我的名字是：" + name);
    }
  }

  class Dog extends Animal {
    static info = "这是Dog的静态属性"
    
    //构造器，默认为空的构造器
    //当class在被new时就会调用构造器
    //相当于function
    //function myClass(name,age){
    //	this.name=name
    //	this.age=age
    //}
    constructor(name) {
      super();
      this.name = name
    }

    run() {
      console.log(this.name + "会跑")
    }
  }

  let dog = new Dog('dog');
  dog.run();
  dog.eat(dog.name);
  dog.sayName(dog.name);
  console.log(Dog.info);
</script>
</html>